package com.ys.servers.versions.dao.impl;

import com.ys.servers.common.dao.BasicNoSqlDao;
import com.ys.servers.versions.data.AppType;
import com.ys.servers.versions.data.AppVersionsData;
import com.ys.servers.versions.dao.AppVersionsDataDao;
import com.ys.servers.versions.data.AppVersionsState;
import io.vertx.core.Future;

/**
 * Created by taotao on 2017/5/12.
 */
public class AppVersionsDataDaoImpl extends BasicNoSqlDao<AppVersionsData> implements AppVersionsDataDao {
    @Override
    public Future<AppVersionsData> saveAppVersionsData(AppVersionsData appVersionsData) {
        appVersionsData.setId(appVersionsData.getVersions() + ":" + appVersionsData.getAppType() + ":" + appVersionsData.getAppVersionState());
        return this.addData(appVersionsData);
    }

    @Override
    public Future<AppVersionsData> getAppVersionsData(String versions, AppType appType, AppVersionsState appVersionsState) {
        return this.getData(versions + ":" + appType + ":" + appVersionsState, AppVersionsData.class);
    }
}
